<?php
// Only display Categories that have products

$strSideMenuSQL = "SELECT tblMenu.* 
					, tblCategory.Description
					FROM tblMenu
					LEFT JOIN tblCategory  ON tblMenu.CategoryID = tblCategory.ID";
    
				//echo $strSQL;
	
	$strJoin = " WHERE ";
		if (isset($strCategoryList))
		{
			$strSideMenuSQL .= $strJoin."tblMenu.CategoryID IN (".mysql_escape_string($strCategoryList).")"; 
			$strJoin = " AND ";
			unset($strCategoryList);
		}else{
		
	    	if (isset($intSideMenuCategoryID))
	    	{
	        	$strSideMenuSQL .= $strJoin."tblMenu.CategoryID = '".mysql_escape_string($intSideMenuCategoryID)."'";
	        	$strJoin = " AND ";
				unset($intSideMenuCategoryID);
	    	}
	    }
		
		if (isset($strSelectCategory))
		{
	        $strSideMenuSQL .= $strJoin."tblMenu.CategoryName LIKE '".mysql_escape_string($strSelectCategory)."%'";
	        $strJoin = " AND ";
	    }
		
	
	$strSideMenuSQL .= " ORDER BY CategoryName, SubCategory";
	$objSideMenu = new MySqlResults($strSideMenuSQL);
	//echo "<br>".$strSideMenuSQL;
		if($objSideMenu->ErrorMessages){
			array_push($ActionResults, $objSideMenu->ErrorMessages);
		}


?>
